from Components.Component import Component

class WebInputXY(Component):

  def __call__(self, values):
  
    # does values['stack'] exist?
    if not 'stack' in values.keys():     # 'stack': [['2', '8']]
        values['status'] = "WebInputXY component<br>is awaiting input"
        values['input'] = "<form id='input_form'>x: <input type='text' value='2'/><br>y: <input type='text' value='8'/></form>"

        # loop on self until values['status'] is received
        return (([self], values),) 
    
    # go to next actor in workflow
    else: 
        x = int(values['stack'][0][0])
        y = int(values['stack'][0][1])
        values['x'] = x
        values['y'] = y
        return (([self.get_connection()], values),)
    